(define (tail-replicate x n)
  (define (tail-replicate-in so-far x n)
    (cond 
      ((= n 0)
       so-far)
      (else
       (tail-replicate-in (cons x so-far) x (- n 1)))))
  (tail-replicate-in nil x n))

(define-macro (def func args body)
  (list 'define (cons func args) body))

(define (repeatedly-cube n x)
  (if (zero? n)
      x
      (let ((y (repeatedly-cube (- n 1) x)))
        (* y y y))))
